<%@ page import="restfuljobs.JobListing" %>

<g:if test="${session.user && session.user.type == restfuljobs.User.Type.RECRUITER}">
	<g:hiddenField name="recruiter.id" value="${session.user.id}" />
</g:if>
<g:else><b>Only recruiters are allowed to create jobs!</b></g:else>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'employer', 'error')} ">
	<label for="employer">
		<g:message code="jobListing.employer.label" default="Employer" />
		
	</label>
	<g:textField name="employer" value="${jobListingInstance?.employer}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'jobCategory', 'error')} ">
	<label for="jobCategory">
		<g:message code="jobListing.jobCategory.label" default="Job Category" />
		
	</label>
	<g:textField name="jobCategory" value="${jobListingInstance?.jobCategory}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'jobDescription', 'error')} ">
	<label for="jobDescription">
		<g:message code="jobListing.jobDescription.label" default="Job Description" />
		
	</label>
	<g:textField name="jobDescription" value="${jobListingInstance?.jobDescription}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'jobTitle', 'error')} ">
	<label for="jobTitle">
		<g:message code="jobListing.jobTitle.label" default="Job Title" />
		
	</label>
	<g:textField name="jobTitle" value="${jobListingInstance?.jobTitle}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'jobType', 'error')} ">
	<label for="jobType">
		<g:message code="jobListing.jobType.label" default="Job Type" />
		
	</label>
	<g:textField name="jobType" value="${jobListingInstance?.jobType}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'location', 'error')} ">
	<label for="location">
		<g:message code="jobListing.location.label" default="Location" />
		
	</label>
	<g:textField name="location" value="${jobListingInstance?.location}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'salaryFrom', 'error')} required">
	<label for="salaryFrom">
		<g:message code="jobListing.salaryFrom.label" default="Salary From" />		
	</label>
	<g:textField name="salaryFrom" required="" value="${fieldValue(bean: jobListingInstance, field: 'salaryFrom')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'salaryTo', 'error')} required">
	<label for="salaryTo">
		<g:message code="jobListing.salaryTo.label" default="Salary To" />
	</label>
	<g:textField name="salaryTo" required="" value="${fieldValue(bean: jobListingInstance, field: 'salaryTo')}"/>
</div>

<g:if test="${jobListingInstance.id}">
<div class="fieldcontain ${hasErrors(bean: jobListingInstance, field: 'status', 'error')} required">
	<label for="status">
		<g:message code="jobListing.status.label" default="Status" />
	</label>
	<g:select name="status" from="${restfuljobs.JobListing$Status?.values()}" keys="${restfuljobs.JobListing$Status.values()*.name()}" required="" value="${jobListingInstance?.status?.name()}"/>
</div>
</g:if><g:else>
	<g:hiddenField name="status" value="OPEN" />
</g:else>
